<!--素材选择器-->
<template>
    <el-dialog title="选择素材"  :visible.sync="dataVisible" :modal="true" append-to-body  @close="onClose">
        <material-news v-if="selectType === 'news'" @selected="onSelect" selectMode/>
<!--        <mater-select-dialog v-model="selectItem"/>-->
        <material-file v-else :fileType="selectType" @selected="onSelect" selectMode/>
    </el-dialog>
</template>
<script>
import MaterSelectDialog from "@/components/dialog/wx/materSelectDialog";
export default {
    name:"assets-selector",
    props:{
        selectType:{// image、voice、video、news
            type:String,
            default:'image'
        },
        value:{
            type:Boolean,
            default:false
        }
    },
    data(){
        return {
            selectItem:''
        }
    },
    components:{
        MaterSelectDialog,
        MaterialFile:()=>import('@/components/wx/material/mteFile'),
        MaterialNews:()=>import('@/components/wx/material/mteNews')
    },
    computed:{
        dataVisible:{
            get(){
                return this.value
            },
            set(val){
                this.$emit('input',val)
            }
        }
    },
    methods:{
        onSelect(itemInfo){
            this.$emit('selected', itemInfo)
        },
        onClose(){
            this.$emit('onClose')
        }
    }
}
</script>